<%= render 'templates/title', template: @template %>
<div>
  <%= link_to template_path(@template) do %>
    &larr;
    <span>Back to Active</span>
  <% end %>
</div>
<div class="flex justify-between mb-6 md:items-end flex-col md:flex-row">
  <p class="text-3xl font-bold">Submissions <span class="badge badge-outline badge-lg align-middle">Archived</span></p>
  <div class="flex space-x-2 mt-3 md:mt-0">
    <% if params[:q].present? || @pagy.pages > 1 %>
      <%= render 'shared/search_input' %>
    <% end %>
    <%= link_to new_template_submissions_export_path(@template), class: 'order-3 md:order-1 btn btn-ghost text-base', data: { turbo_frame: 'modal' } do %>
      <%= svg_icon('download', class: 'w-6 h-6 stroke-2') %>
      <span>Export</span>
    <% end %>
  </div>
</div>
<% if @pagy.count > 0 %>
  <div class="space-y-4">
    <%= render partial: 'templates/submission', collection: @submissions %>
  </div>
<% elsif params[:q].present? %>
  <div class="text-center">
    <div class="mt-16 text-3xl font-semibold">
      Submissions not Found
    </div>
  </div>
<% end %>
<%= render 'shared/pagination', pagy: @pagy, items_name: 'submissions' %>
